/*
 * @Author: xcl
 * @Date: 2022-04-20 18:06:07
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2022-10-19 09:57:10
 * @Description: 路由
 */
import Vue from "vue";
import VueRouter from "vue-router";
Vue.use(VueRouter);

/* 首页 */
import HomeIndex from "../views/home/Index.vue";
import Home from "../views/home/Home.vue";

/* 视频融合 */
import VideoIndex from "../views/video/Index.vue";
import Video from "../views/video/Video.vue";

/* 迁徙图 */
import MigrationIndex from "../views/migration/Index.vue";
import Migration from "../views/migration/Migration.vue";

/* 分析剖切 */
import SectionIndex from "../views/section/Index.vue";
import Section from "../views/section/Section.vue";

/* 漫游 */
import RoamingIndex from "../views/roaming/Index.vue";
import Roaming from "../views/roaming/Roaming.vue";

/* 绘制点、线、面 */
import DrawIndex from "../views/draw/Index.vue";
import Draw from "../views/draw/Draw.vue";

/* 单体分层化 */
import MonolithicLayeringIndex from "../views/monolithicLayering/Index.vue";
import MonolithicLayering from "../views/monolithicLayering/MonolithicLayering.vue";

/** 3D特效 */
import EffectsIndex from "../views/effects/Index.vue";
import Effects from "../views/effects/Effects.vue";

/* 项目实例 */
import ProjectIndex from "../views/project/Index.vue";
import Project from "../views/project/Project.vue";

/* 测试实例 */
import TestIndex from "../views/test/Index.vue";
import Test from "../views/test/Test.vue";

/* Echarts */
import EchartsIndex from "../views/echarts/Index.vue";
import Echarts from "../views/echarts/Echarts.vue";

/* BPMN */
import BPMNIndex from "../views/bpmn/Index.vue";
import BPMN from "../views/bpmn/BPMN.vue";

/* Babylon */
import BabylonIndex from "../views/babylon/Index.vue";
import Babylon from "../views/babylon/Babylon.vue";

/* Vjsf */
import VjsfIndex from "../views/vjsf/Index.vue";
import Vjsf from "../views/vjsf/Vjsf.vue";

/* Mock */
import MockIndex from "../views/mock/Index.vue";
import Mock from "../views/mock/Mock.vue";

const routes = [
  // 设置默认进入页面
  {
    path: "*",
    redirect: "/home",
  },
  // 首页
  {
    path: "/home",
    name: "HomeIndex",
    component: HomeIndex,
    meta: {
      showNav: true, // 是否显示顶部导航
    },
    children: [{
      path: "/home",
      name: "Home",
      component: Home,
      meta: {
        showNav: true, // 是否显示顶部导航
      },
      children: [],
    },],
  },
  // 视频融合
  {
    path: "/video",
    name: "VideoIndex",
    component: VideoIndex,
    meta: {
      showNav: true, // 是否显示顶部导航
    },
    children: [{
      path: "/video",
      name: "Video",
      component: Video,
      meta: {
        showNav: true, // 是否显示顶部导航
      },
      children: [],
    },],
  },
  // 分析剖切
  {
    path: "/section",
    name: "SectionIndex",
    component: SectionIndex,
    meta: {
      showNav: true, // 是否显示顶部导航
    },
    children: [{
      path: "/section",
      name: "Section",
      component: Section,
      meta: {
        showNav: true, // 是否显示顶部导航
      },
      children: [],
    },],
  },
  // 漫游
  {
    path: "/roaming",
    name: "RoamingIndex",
    component: RoamingIndex,
    meta: {
      showNav: true, // 是否显示顶部导航
    },
    children: [{
      path: "/roaming",
      name: "Roaming",
      component: Roaming,
      meta: {
        showNav: true, // 是否显示顶部导航
      },
      children: [],
    },],
  },
  // 迁徙图
  {
    path: "/migration",
    name: "MigrationIndex",
    component: MigrationIndex,
    meta: {
      showNav: true, // 是否显示顶部导航
    },
    children: [{
      path: "/migration",
      name: "Migration",
      component: Migration,
      meta: {
        showNav: true, // 是否显示顶部导航
      },
      children: [],
    },],
  },
  // 绘制点、线、面
  {
    path: "/draw",
    name: "DrawIndex",
    component: DrawIndex,
    meta: {
      showNav: true, // 是否显示顶部导航
    },
    children: [{
      path: "/draw",
      name: "Draw",
      component: Draw,
      meta: {
        showNav: true, // 是否显示顶部导航
      },
      children: [],
    },],
  },
  // 3D特效
  {
    path: "/effects",
    name: "EffectsIndex",
    component: EffectsIndex,
    meta: {
      showNav: true, // 是否显示顶部导航
    },
    children: [{
      path: "/effects",
      name: "Effects",
      component: Effects,
      meta: {
        showNav: true, // 是否显示顶部导航
      },
      children: [],
    },],
  },
  // 单体分层化
  {
    path: "/monolithicLayering",
    name: "MonolithicLayeringIndex",
    component: MonolithicLayeringIndex,
    meta: {
      showNav: true, // 是否显示顶部导航
    },
    children: [{
      path: "/monolithicLayering",
      name: "MonolithicLayering",
      component: MonolithicLayering,
      meta: {
        showNav: true, // 是否显示顶部导航
      },
      children: [],
    },],
  },
  // 项目实例
  {
    path: "/project",
    name: "ProjectIndex",
    component: ProjectIndex,
    meta: {
      showNav: true, // 是否显示顶部导航
    },
    children: [{
      path: "/project",
      name: "Project",
      component: Project,
      meta: {
        showNav: true, // 是否显示顶部导航
      },
      children: [],
    },],
  },
  // 测试用例
  {
    path: "/test",
    name: "TestIndex",
    component: TestIndex,
    meta: {
      showNav: true, // 是否显示顶部导航
    },
    children: [{
      path: "/test",
      name: "Test",
      component: Test,
      meta: {
        showNav: true, // 是否显示顶部导航
      },
      children: [],
    },],
  },
  // Echarts
  {
    path: "/echarts",
    name: "EchartsIndex",
    component: EchartsIndex,
    meta: {
      showNav: true, // 是否显示顶部导航
    },
    children: [{
      path: "/echarts",
      name: "Echarts",
      component: Echarts,
      meta: {
        showNav: true, // 是否显示顶部导航
      },
      children: [],
    },],
  },
  // BPMN
  {
    path: "/bpmn",
    name: "BPMNIndex",
    component: BPMNIndex,
    meta: {
      showNav: true, // 是否显示顶部导航
    },
    children: [{
      path: "/bpmn",
      name: "BPMN",
      component: BPMN,
      meta: {
        showNav: true, // 是否显示顶部导航
      },
      children: [],
    },],
  },
  // Babylon
  {
    path: "/babylon",
    name: "BabylonIndex",
    component: BabylonIndex,
    meta: {
      showNav: true, // 是否显示顶部导航
    },
    children: [{
      path: "/babylon",
      name: "Babylon",
      component: Babylon,
      meta: {
        showNav: true, // 是否显示顶部导航
      },
      children: [],
    },],
  },
  // Vjsf
  {
    path: "/vjsf",
    name: "VjsfIndex",
    component: VjsfIndex,
    meta: {
      showNav: true, // 是否显示顶部导航
    },
    children: [{
      path: "/vjsf",
      name: "Vjsf",
      component: Vjsf,
      meta: {
        showNav: true, // 是否显示顶部导航
      },
      children: [],
    },],
  },
  // Mock
  {
    path: "/mock",
    name: "MockIndex",
    component: MockIndex,
    meta: {
      showNav: true, // 是否显示顶部导航
    },
    children: [{
      path: "/mock",
      name: "Mock",
      component: Mock,
      meta: {
        showNav: true, // 是否显示顶部导航
      },
      children: [],
    },],
  },
];

// 解决NavigationDuplicated
const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch((err) => err);
};

const router = new VueRouter({
  mode: "hash", // history 和 hash 模式
  base: process.env.BASE_URL,
  // base: "/SYS/",
  routes,
});

export default router;